<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLicensedGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('licensed_goods', function (Blueprint $table) {
            $table->increments('id')->comment('已授权的商品');

            $table->integer('authorization_id')->unsigned()->comment('供销关系授权表 ID');
            $table->integer('goods_id')->unsigned()->comment('商品 ID');
            $table->integer('strategy_id')->unsigned()->comment('价格策略 ID');
            $table->integer('province_id')->unsigned()->comment('授权区域省份 ID，可为空，为空表示全国可授权')->nullable();
            $table->integer('city_id')->unsigned()->comment('授权市区 ID')->nullable();
            $table->integer('county_id')->unsigned()->comment('授权县、镇、村、街道 ID')->nullable();
            $table->boolean('status')->comment('该商品授权状态')->default(true);

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('licensed_goods');
    }
}
